<template>
<!--  <a-table :columns="columns" :data-source="professors" :pagination="pagination">-->
<!--    <a slot="name" slot-scope="text">{{ text }}</a>-->
<!--    <span slot="customTitle">姓名</span>-->
<!--    <span slot="start" slot-scope="text, record">-->
<!--          <a-rate v-model="professors.value" @change="change(record)"/>-->
<!--    </span>-->
<!--  </a-table>-->
  <table  class="tb">
    <tr>
      <th v-for="column in columns">{{column.title}}</th>
    </tr>
    <tr v-for="professor in professors">
      <td>{{professor.name}}</td>
      <td>{{professor.type}}</td>
      <td v-if="isDisabled"><a-rate :disabled="isDisabled" v-model="professor.value" style="pointer-events: none;"></a-rate></td>
      <td v-else><a-rate  v-model="professor.value" @change="change(professor.key)"></a-rate></td>
      <a-divider/>
    </tr>
  </table>
</template>

<script>
    export default {
        name: "DynamicProjectProfessor",
      props:{
        professors:{
          type:Array,
          default:[],
          required:false,
        },
        isDisabled:{
          type:Boolean,
          default: false,
        }
      },
      data() {
        return {
          columns :[
            {
              dataIndex: 'name',
              title: '姓名',
              key: 'name',
              slots: { title: 'customTitle' },
              scopedSlots: { customRender: 'name' },
            },
            {
              title: '所属专家类型',
              dataIndex: 'type',
              key: 'type',
            },
            {
              title: '评分',
              key: 'start',
              scopedSlots: { customRender: 'start' },
            },
          ],
          pagination:false,
        };
      },
      methods:{
          change(record){
            this.$emit("updateProfessorData",this.professors)
          }
      }
    }

</script>

<style scoped>

  .tb{
    text-align: center;
    border-spacing: 60px 20px;
    border-collapse: separate;
  }
</style>